]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
placeDisplay: Create our own PlacesManager
authorJasper St. Pierre <jstpierre@mecheye.net>
Wed, 2 May 2012 19:40:31 +0000 (15:40 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 7 May 2012 18:29:20 +0000 (15:29 -0300)
Since we don't have a section showing off the available places somewhere,
we don't need a global PlacesManager.

https://bugzilla.gnome.org/show_bug.cgi?id=675328

js/ui/main.js
js/ui/placeDisplay.js

index 25ad8d8b3aeeae14efefec6a6c7bab1a7e42a36e..f1795946f6cc65016c836d8177cd6e63e012061b 100644 (file)
@@ -46,7 +46,6 @@ let automountManager = null;
 let autorunManager = null;
 let panel = null;
 let hotCorners = [];
-let placesManager = null;
 let overview = null;
 let runDialog = null;
 let lookingGlass = null;
@@ -80,7 +79,6 @@ function _createUserSession() {
     // not loading any events until the user presses the clock
     global.launch_calendar_server();
 
-    placesManager = new PlaceDisplay.PlacesManager();
     telepathyClient = new TelepathyClient.Client();
     automountManager = new AutomountManager.AutomountManager();
     autorunManager = new AutorunManager.AutorunManager();
index c3117df49bc8a0d66144906bfb2a0d5011f9115c..ac8e4dbcb0083bae869dc0b17784700afc24b57e 100644 (file)
@@ -365,12 +365,13 @@ const PlaceSearchProvider = new Lang.Class({
 
     _init: function() {
         this.parent(_("PLACES & DEVICES"));
+        this.placesManager = new PlacesManager();
     },
 
     getResultMetas: function(resultIds) {
         let metas = [];
         for (let i = 0; i < resultIds.length; i++) {
-            let placeInfo = Main.placesManager.lookupPlaceById(resultIds[i]);
+            let placeInfo = this.placesManager.lookupPlaceById(resultIds[i]);
             if (!placeInfo)
                 metas.push(null);
             else
@@ -385,13 +386,13 @@ const PlaceSearchProvider = new Lang.Class({
     },
 
     activateResult: function(id, params) {
-        let placeInfo = Main.placesManager.lookupPlaceById(id);
+        let placeInfo = this.placesManager.lookupPlaceById(id);
         placeInfo.launch(params);
     },
 
     _compareResultMeta: function (idA, idB) {
-        let infoA = Main.placesManager.lookupPlaceById(idA);
-        let infoB = Main.placesManager.lookupPlaceById(idB);
+        let infoA = this.placesManager.lookupPlaceById(idA);
+        let infoB = this.placesManager.lookupPlaceById(idB);
         return infoA.name.localeCompare(infoB.name);
     },
 
@@ -409,19 +410,21 @@ const PlaceSearchProvider = new Lang.Class({
             else if (mtype == Search.MatchType.SUBSTRING)
                 substringResults.push(place.id);
         }
-        prefixResults.sort(this._compareResultMeta);
-        substringResults.sort(this._compareResultMeta);
+        prefixResults.sort(Lang.bind(this, this._compareResultMeta));
+        substringResults.sort(Lang.bind(this, this._compareResultMeta));
 
         return prefixResults.concat(substringResults);
     },
 
     getInitialResultSet: function(terms) {
-        let places = Main.placesManager.getAllPlaces();
+        let places = this.placesManager.getAllPlaces();
         return this._searchPlaces(places, terms);
     },
 
     getSubsearchResultSet: function(previousResults, terms) {
-        let places = previousResults.map(function (id) { return Main.placesManager.lookupPlaceById(id); });
+        let places = previousResults.map(Lang.bind(this, function(id) {
+            return this.placesManager.lookupPlaceById(id);
+        }));
         return this._searchPlaces(places, terms);
     }
 });